import request from '@/service'
import type { IAcccountLogin, IPhoneCode, IPhoneCodeLogin } from './type'

// 验证码图片
export const getCaptchaImgSrc = () => {
  return request.get({
    url: 'admin/captcha',
    showLoading: false,
    showMessage: false
  })
}

// 账号登录
export const postAccountLogin = (data: IAcccountLogin) => {
  return request.post({
    url: 'admin/login',
    data: data,
    showLoading: false,
    showMessage: false
  })
}

// 用户信息
export const getUserInfo = () => {
  return request.get({
    url: 'admin/login-user',
    showLoading: true,
    showMessage: true
  })
}

// 发送验证码
export const getSendPhone = (params: IPhoneCode) => {
  return request.get({
    url: 'admin/send-user-mobile',
    params: params,
    showLoading: true,
    showMessage: true
  })
}

// 短信登录
export const postMoblieLogin = (data: IPhoneCodeLogin) => {
  return request.post({
    url: 'admin/login-code',
    data: data,
    showLoading: true,
    showMessage: true
  })
}

// 字典
export const getAllDict = () => {
  return request.get({
    url: 'admin/dict/all-options',
    showLoading: false,
    showMessage: false
  })
}
